Skip to main content

ARDK for Android/com.nianticlabs.ardk.objectdetection/transformed

transformed

[androidJvm]
fun DetectedObject.transformed(display: Matrix?, reprojection: Matrix? = null, containerSize: Size, viewportSize: Size): DetectedObject

Transforms this DetectedObject's bounding box from model space into viewport space, using optional reprojection and display matrices.

The transformation happens in two stages:

  1. reprojection — (optional) applies a full 3×3 projective homography to reproject bounding box coordinates from the camera pose at detection time to the current frame pose.
  2. display — (optional) applies a 2D affine transformation to map normalized coordinates from model space into the screen's coordinate system (e.g. scale and offset into the viewport).

Return​

A new DetectedObject with transformed pixel-space coordinates.

Parameters​

androidJvm

displayAn optional affine Matrix that maps normalized model-space coordinates into the screen or viewport coordinate system.
reprojectionAn optional projective Matrix that reprojects coordinates to match the current camera pose, compensating for camera motion since detection.
containerSizeThe size of the model's input frame (used to normalize the bounding box).
viewportSizeThe size of the current screen or viewport (used to scale up to pixels).